package client

import (
	"github.com/micro/go-micro/v2"
	"github.com/micro/go-micro/v2/registry"
	"github.com/micro/go-plugins/registry/consul/v2"
	"micro/proto/getid"
)

var (
	getidClient getid.GetIdService
)

func GetGetIdClient() getid.GetIdService {
	if getidClient == nil {
		//注册到consul
		consulReg := consul.NewRegistry(registry.Addrs("127.0.0.1:8500"))
		service := micro.NewService(micro.Registry(consulReg))
		getidClient = getid.NewGetIdService("go.micro.test.getid", service.Client())
	}
	return getidClient
}
